(Al-Kahf) 18 : 16
وَإِذِ اعْتَزَلْتُمُوهُمْ وَمَا يَعْبُدُونَ إِلَّا اللَّهَ فَأْوُوا إِلَى الْكَهْفِ يَنْشُرْ لَكُمْ رَبُّكُمْ مِنْ رَحْمَتِهِ وَيُهَيِّئْ لَكُمْ مِنْ أَمْرِكُمْ مِرْفَقًا
And when you have withdrawn from them and that which they serve besides Lord Allah, retreat to the cave. Your Lord will spread out for you of His mercy and will prepare for you from your affair facility".
When disbelievers plotted to kill Messenger Muhammad, on his migration to Medina, he and his companion Aboobacker have taken refuge in Thawr cave as explained in verse 9: 40. See explanation 10: 103 and 12: 110.